﻿@using System.Linq.Expressions
@using JaxDug.Models
@model IEnumerable<UserViewModel>
@{
    
}
@helper Label(Expression<Func<UserViewModel>> selector){
    @Html.LabelFor(x=>x.SelectMany(selector))
}
<table>
    <thead>
        <tr>
            <th>@Label(x => x.SelectMany(m => m.UserName))</th>
            <th>@Html.LabelFor(x => x.SelectMany(m => m.IsApproved))</th>
            <th>@Html.LabelFor(x => x.SelectMany(m => m.EmailAddress))</th>
            <th>@Html.LabelFor(x => x.SelectMany(m => m.Comment))</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var uvm in Model ?? Enumerable.Empty<JaxDug.Models.UserViewModel>)
        {
            <tr>
                <td>@Html.DisplayFor(m => uvm.UserName)</td>
                <td>@Html.DisplayFor(m => uvm.IsApproved)</td>
                <td>@Html.DisplayFor(m => uvm.EmailAddress)</td>
                <td>@Html.DisplayFor(m => uvm.Comment)</td>

            </tr>
        }
    </tbody>
</table>
<fieldset>
    <legend>UserViewModel</legend>


    <div class="display-label">IsApproved</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.IsApproved)
    </div>

    <div class="display-label">EmailAddress</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.EmailAddress)
    </div>

    <div class="display-label">Comment</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Comment)
    </div>
</fieldset>
<p>
    @Html.ActionLink("Edit", "Edit", new { /* id=Model.PrimaryKey */ }) |
    @Html.ActionLink("Back to List", "Index")
</p>
